import request from '@/utils/request'
import { authAPiUrl } from '@/api/config.js'

/**
 * 获取角色资源
 * @param {Object} params  eg：{roleId: 'xxxx', resType: ''} 
 */
export function getRoleResource(params) {
  return request({
    url: authAPiUrl + '/res/queryRoleResourceLink',
    method: 'get',
    params
  })
}

/**
 * 更新角色资源
 */
export function addRoleResource(data) {
    return request({
        url: authAPiUrl + `/roleresource/save?roleId=${data.roleId}`,
        method: 'post',
        data: data.data
    })
}

/**
 * 
 * @param {Object} params  eg: {id: 'xxx'}
 */
export function getRoleDetail(params) {
    return request({
        url: authAPiUrl + '/role/load/id',
        method: 'get',
        params
    })
}